package slxy.jiangtao.dts.service.sys;

import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import slxy.jiangtao.dts.controller.admin.FilesUploadController;
import slxy.jiangtao.dts.core.common.service.CommonService;
import slxy.jiangtao.dts.core.util.StringUtil;
import slxy.jiangtao.dts.entity.business.Archives;
import slxy.jiangtao.dts.entity.business.Summary;

import java.io.FileNotFoundException;

/**
 * Code must be sexy
 * Created by Jiang Tao on 2017/5/4.
 * 说明：
 */
@Service("documentService")
public class DocumentService {
    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(FilesUploadController.class);

    @Autowired
    CommonService commonService;
    @Autowired
    SystemFileService systemFileService;
    public boolean deleteArchives(Archives archives) throws FileNotFoundException{
        if(StringUtil.isNotEmpty(archives.getFileNo())){
            systemFileService.deleteFileWordAndHtml(archives.getFileNo());
            commonService.delete(archives);
        }
        return true;
    }

    public boolean deleteSummery(Summary summary) throws FileNotFoundException{
        if(StringUtil.isNotEmpty(summary.getFileNo())){
            systemFileService.deleteFileWordAndHtml(summary.getFileNo());
            commonService.delete(summary);
        }
        return true;
    }


}
